<template>
    <div>
        <div class="index">
            <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect" background-color="#2d2f33" text-color="#fff" active-text-color="#FFFF33">
                <div class="w1">
                    <el-menu-item><img src="https://bbs.mihoyo.com/_nuxt/img/miHoYo_Game.a137b1d.png" width="100px" alt=""></el-menu-item>
                    <span>| 米游社·原神</span>
                </div>
                <div class="w2">
                    <el-menu-item index="1" :style="[{fontSize: activeIndexState === '1' ? 18+'px': 15+'px'}, {backgroundColor: activeIndexState === '1' ? 'rgba(255,255,255,.18)' : ''}]">首页</el-menu-item>
                    <el-menu-item index="2" :style="[{fontSize: activeIndexState === '2' ? 18+'px': 15+'px'}, {backgroundColor: activeIndexState === '2' ? 'rgba(255,255,255,.18)' : ''}]">酒馆</el-menu-item>
                    <el-menu-item index="3" :style="[{fontSize: activeIndexState === '3' ? 18+'px': 15+'px'}, {backgroundColor: activeIndexState === '3' ? 'rgba(255,255,255,.18)' : ''}]">攻略</el-menu-item>
                    <el-menu-item index="4" :style="[{fontSize: activeIndexState === '4' ? 18+'px': 15+'px'}, {backgroundColor: activeIndexState === '4' ? 'rgba(255,255,255,.18)' : ''}]">官方</el-menu-item>
                    <el-menu-item index="5" :style="[{fontSize: activeIndexState === '5' ? 18+'px': 15+'px'}, {backgroundColor: activeIndexState === '5' ? 'rgba(255,255,255,.18)' : ''}]">观测枢</el-menu-item>
                    <el-submenu index="6">
                        <template slot="title" :style="[{fontSize: more === '同人图' || 'COS' || '硬核' ? 30+'px': 15+'px'}, {backgroundColor: activeIndexState === '1' ? 'rgba(255,255,255,.18)' : ''}]">{{more}}</template>
                        <el-menu-item index="同人图">同人图</el-menu-item>
                        <el-menu-item index="COS">COS</el-menu-item>
                        <el-menu-item index="硬核">硬核</el-menu-item>
                    </el-submenu>
                </div>
                <div class="w3">
                    <div class="w3_1">
                        <!-- <el-input size="medium" v-model="input" suffix-icon="el-icon-search" :style="{'width':(lenVal===1?80+'px':130+'px')}" @focus="lenVal=2" @blur="lenVal=1"></el-input> -->
                        <input type="text" :style="{'width':(lenVal===1?60+'px':100+'px')}" @focus="lenVal=2" @blur="lenVal=1">
                        <i class="el-icon-search"></i>
                    </div>
                </div>
                <div class="w4">
                    <el-menu-item index="7">关注</el-menu-item>
                    <div class="w4_3">
                        <el-menu-item index="8">
                            消息
                        </el-menu-item>
                        <div class="w4_3_1">
                            <div v-for="i in setna" :key="i" @click="ppppp(i)">{{i}}</div>
                        </div>
                    </div>
                    <div class="w4_1">
                        <el-menu-item index="9">
                            <img src="https://img-static.mihoyo.com/communityweb/upload/41db12dd1d0ac5730be9946da674af1b.png" alt="">
                        </el-menu-item>
                        <div class="w4_2">
                            <div class="w4_2_1">
                                <img src="https://img-static.mihoyo.com/communityweb/upload/41db12dd1d0ac5730be9946da674af1b.png" alt="">
                            </div>
                            <span>憨憨还无语</span>
                            <div class="w4_2_2">
                                <div class="ti1">
                                    <div class="sp1">0</div>
                                    <div class="sp2">粉丝</div>
                                </div>
                                <div class="ti1">
                                    <div class="sp1">0</div>
                                    <div class="sp2">关注</div>
                                </div>
                            </div>
                            <div class="w4_2_3">
                                <div class="ti1">个人中心</div>
                                <div class="ti1">米哈游通行证</div>
                            </div>
                            <div class="w4_2_4">
                                退出登录
                            </div>
                        </div>
                    </div>
                    <div class="w44" @click="Login_status2 = true">
                        测试登录注册页
                    </div>
                    <!-- <el-submenu index="9">
                        <template slot="title"><img src="https://img-static.mihoyo.com/communityweb/upload/41db12dd1d0ac5730be9946da674af1b.png" alt=""></template>
                        <el-menu-item index="2-1">同人图</el-menu-item>
                        <el-menu-item index="2-2">COS</el-menu-item>
                        <el-menu-item index="2-3">硬核</el-menu-item>
                    </el-submenu> -->
                </div>
            </el-menu>
        </div>

        <!-- 注册登录框 -->
        <div class="register" v-show="Login_status2 === true">
            <div class="register_1">
                <div class="pp" @click="Login_status2 = false">X</div>
                <div class="p1">
                    <span class="tr1" @click="Login_status = 1" :style="[{borderBottom: Login_status === 1? '3px solid #ffe14c':''},{color: Login_status === 1? 'black':''}]">短信登录</span>
                    <span class="tr2" @click="Login_status = 2" :style="[{borderBottom: Login_status === 2? '3px solid #ffe14c':''},{color: Login_status === 2? 'black':''}]">密码登录</span>
                </div>
                <div class="reg1" v-show="Login_status === 1">
                    <div class="p2">
                        <input type="text" placeholder="手机号码登录注册">
                        <input type="text" placeholder="验证码">
                        <span class="tr3">获取验证码</span>
                    </div>
                    <div class="p3">登录</div>
                    <div class="p4">
                        <span class="tr4">登录遇到问题?</span>
                        <span class="tr4">立即注册</span>
                    </div>
                    <div class="p5">
                        未注册的手机验证后将自动登录。注册/登录即代表您同意并遵守 
                        <span class="tr5">《米哈游通行证用户服务协议》 《米哈游通行证用户个人信息及隐私保护政策》</span>
                    </div>
                </div>
                <div class="reg2" v-show="Login_status === 2">
                    <div class="p2">
                        <input type="text" placeholder="手机号码/邮箱/用户名">
                        <input type="text" placeholder="密码">
                        <!-- <span class="tr3">获取验证码</span> -->
                    </div>
                    <div class="p3">登录</div>
                    <div class="p4">
                        <span class="tr4">登录遇到问题?</span>
                        <span class="tr4">立即注册</span>
                    </div>
                    <div class="p5">
                        登录即代表您同意并遵守 
                        <span class="tr5">《米哈游通行证用户服务协议》 《米哈游通行证用户个人信息及隐私保护政策》</span>
                    </div>
                </div>
            </div>
        </div>

        <div class="index2">
            <router-view />
        </div>
    </div>
</template>

<script>
export default {
    data() {
        return {
            Login_status: 1,
            Login_status2: false,
            activeIndex: '1',
            activeIndexState: '1',
            lenVal: 1,
            input: '',
            more: '更多',
            navigation_bar: ['首页', '酒馆', '攻略', '官方', '观测区', '更多'],
            Navigation_bar_sub: ['同人图', 'COS', '硬核'],
            setna: ['回复我的', '主动@我', '收到的赞', '系统通知'],
        }
    },
    methods: {
        ppppp(i) {
            console.log(i);
        },
        handleSelect(key, keyPath) {
            console.log(key, keyPath);
            if(key === '1' || '2' || '3' || '4' || '5' || '6' || '7' || '8') this.more = '更多'
            this.activeIndexState = key
            if(key == '1') {
                // 首页
                this.$router.push('/home_page')
            }else if(key == '2') {
                // 酒馆
                this.$router.push('/pub')
            }else if(key == '3') {
                // 攻略
                this.$router.push('/strategy')
            }else if(key == '4') {
                // 官方
                this.$router.push('/official')
            }else if(key === '5') {
                // 观测枢
                this.$router.push('./observation_pivot')
            }else if(key === '7') {
                // 关注
                this.$router.push('/follow')
            }else if(key === '8') {
                // 消息
                this.$router.push('/news')
            }else if(key === '同人图') {
                // 同人图
                this.more = key
                this.$router.push('/peer_map')
            }else if(key == 'COS') {
                // COS
                this.more = key
                this.$router.push('/mycos')
            }else if(key == '硬核') {
                // 硬核
                this.more = key
                this.$router.push('/hard_core')
            }
            
        },
    }
}
</script>

<style lang="less" scoped>
    *{
        padding: 0;
        margin: 0;
    }
    .register {
        border: 1px solid red;
        // opacity: 0.5;
        position: absolute;
        // background-color: rgb(216, 216, 216);
        // color: white;
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 3;
        .register_1  {
            position: relative;
            // border: 1px solid red;
            // opacity: 9;
            padding-bottom: 30px;
            background-color: #fff;
            border-radius: 10px;
            position: absolute;
            width: 500px;
            display: flex;
            justify-content: center;
            flex-wrap: wrap;
            .pp {
                // border: 1px solid red;
                position: absolute;
                height: 30px;
                width: 30px;
                background-color: black;
                color: white;
                display: flex;
                justify-content: center;
                align-items: center;
                border-radius: 50%;
                cursor: pointer;
                // justify-content: flex-end;
                // right: 0;
                margin-left: 550px;
            }
            .p1 {
                border-bottom: 1px solid #ccc;
                width: 96%;
                display: flex;
                // justify-content: space-between;
                span {
                    // border: 1px solid red;
                    padding: 10px;
                    cursor: pointer;
                    font-weight: bolder;
                    font-size: 22px;
                    color: #999;
                }

            }
            input:focus {
                outline: 2px solid #00c3ff;
            }
            .reg1 {
                // border: 1px solid red;
                display: flex;
                flex-wrap: wrap;
                justify-content: center;
                .p2 {
                    // border: 1px solid red;
                    margin-top: 10px;
                    width: 100%;
                    display: flex;
                    flex-wrap: wrap;
                    align-items: center;
                    justify-content: center;
                    input:nth-last-child(3) {
                        margin-top: 20px;
                        border-radius: 10px;
                        border: 1px solid #ccc;
                        padding: 16px;
                        width: 80%;
                    }
                    input:nth-last-child(2) {
                        width: 30px;
                        margin-top: 20px;
                        border-radius: 10px;
                        border: 1px solid #ccc;
                        padding: 16px;
                        width: 30%;
                        margin-right: 135px;
                    }
                    .tr3 {
                        border: 1px solid #ccc;
                        border-radius: 10px;
                        margin-top: 20px;
                        color: #00c3ff;
                        height: 16px;
                        padding: 16px;
                        cursor: pointer;
                    }
                }
                .p3 {
                    // border: 1px solid red;
                    width: 84%;
                    margin-top: 30px;
                    padding: 6px;
                    font-size: 22px;
                    color: #fff;
                    border-radius: 10px;
                    text-align: center;
                    background-color: #00c3ff;
                    cursor: pointer;
                }
                .p4 {
                    // border: 1px solid red;
                    margin-top: 6px;
                    width: 85%;
                    padding: 10px;
                    display: flex;
                    justify-content: space-between;
                    .tr4 {
                        // border: 1px solid red;
                        cursor: pointer;
                        color: #999;
                    }
                }
                .p5 {
                    // border: 1px solid red;
                    margin-top: 10px;
                    width: 85%;
                    font-size: 15px;
                    .tr5 {
                        color: #00c3ff;
                        cursor: pointer;
                    }
                }
            }
            .reg2 {
                // border: 1px solid red;
                display: flex;
                flex-wrap: wrap;
                justify-content: center;
                .p2 {
                    // border: 1px solid red;
                    margin-top: 10px;
                    width: 100%;
                    display: flex;
                    flex-wrap: wrap;
                    align-items: center;
                    justify-content: center;
                    input {
                        margin-top: 20px;
                        border-radius: 10px;
                        border: 1px solid #ccc;
                        padding: 16px;
                        width: 80%;
                    }
                    // input:nth-last-child(2) {
                    //     margin-top: 20px;
                    //     border-radius: 10px;
                    //     border: 1px solid #ccc;
                    //     padding: 16px;
                    //     width: 80%;
                    // }
                    // input:nth-last-child(1) {
                    //     width: 30px;
                    //     margin-top: 20px;
                    //     border-radius: 10px;
                    //     border: 1px solid #ccc;
                    //     padding: 16px;
                    //     width: 30%;
                    //     margin-right: 135px;
                    // }
                    // .tr3 {
                    //     border: 1px solid #ccc;
                    //     border-radius: 10px;
                    //     margin-top: 20px;
                    //     color: #00c3ff;
                    //     height: 16px;
                    //     padding: 16px;
                    //     cursor: pointer;
                    // }
                }
                .p3 {
                    // border: 1px solid red;
                    width: 84%;
                    margin-top: 30px;
                    padding: 6px;
                    font-size: 22px;
                    color: #fff;
                    border-radius: 10px;
                    text-align: center;
                    background-color: #00c3ff;
                    cursor: pointer;
                }
                .p4 {
                    // border: 1px solid red;
                    margin-top: 6px;
                    width: 85%;
                    padding: 10px;
                    display: flex;
                    justify-content: space-between;
                    .tr4 {
                        // border: 1px solid red;
                        cursor: pointer;
                        color: #999;
                    }
                }
                .p5 {
                    // border: 1px solid red;
                    margin-top: 10px;
                    width: 85%;
                    font-size: 15px;
                    .tr5 {
                        color: #00c3ff;
                        cursor: pointer;
                    }
                }
            }
        }
    }
    .index {
        // border: 1px solid red;
        width: 100%;
        position: absolute;
        z-index: 3;
        position: fixed;
        top: 0;
        .el-menu {
            display: flex;
            align-items: center;
            .w1 {
                width: 500px;
                display: flex;
                justify-content: flex-end;
                span {
                    // height: 100%;
                    display: flex;
                    align-items: center;
                    color: white;
                    // border: 1px solid red;
                }
            }
            .w2 {
                // border: 1px solid red;
                width: 30%;
                display: flex;
                justify-content: center;
                .el-submenu {
                    width: 80px;
                }
            }
            .w3 {
                // border: 1px solid red;
                // .el-input {
                //     width: 100px;
                // }
                .w3_1 {
                    // border: 1px solid red;
                    width: 140px;
                    display: flex;
                    justify-content: flex-end;
                    input {
                        width: 80px;
                        height: 25px;
                        border-radius: 20px 0px 0px 20px;
                        border: none;
                        outline: none;
                        // padding: 2px;
                        background-color: #ccc;
                        padding-left: 6px;
                        padding-right: 6px;
                    }
                    i {
                        // border: 1px solid red;
                        // background-color: white;
                        background-color: #ccc;
                        display: flex;
                        align-items: center;
                        font-size: 18px;
                        cursor: pointer;
                        padding: 2px;
                        padding-right: 6px;
                        border-radius: 0px 20px 20px 0px;
                    }
                }
            }
            .w4 {
                // border: 1px solid red;
                height: 100%;
                display: flex;
                align-items: center;
                .w4_3:hover {
                    .w4_3_1 {
                        display: block;
                    }
                }
                .w4_3 {
                    // border: 1px solid red;
                    .w4_3_1 {
                        // border: 1px solid #999;
                        width: 160px;
                        position: absolute;
                        right: 550px;
                        background-color: white;
                        border-radius: 0px 0px 5px 5px;
                        font-size: 15px;
                        // padding: 10px;
                        display: none;
                        cursor: pointer;
                        div:hover {
                            background-color: #00c3ff;
                            color: white;
                        }
                        div {
                            // border: 1px solid red;
                            padding: 10px;
                        }
                    }
                }
                .w4_1 {
                    // border: 1px solid red;
                    img {
                        max-width: 40px;
                        max-height: 40px;
                        border-radius: 50%;
                    }
                    .w4_2 {
                        // border: 1px solid #999;
                        background-color: white;
                        border-radius: 0px 0px 6px 6px;
                        display: none;
                        position: absolute;
                        top: 56px;
                        right: 485px;
                        width: 240px;
                        // height: 500px;
                        text-align: center;
                        .w4_2_1 {
                            display: flex;
                            justify-content: center;
                            padding: 6px;
                            img {
                                max-width: 60px;
                                max-height: 60px;
                                border-radius: 50%;
                            }
                        }
                        .w4_2_2 {
                            // border: 1px solid red;
                            // margin-top: 4px;
                            border-bottom: 1px solid #ebebeb;
                            display: flex;
                            justify-content: space-between;
                            padding: 6px;
                            .ti1 {
                                // border: 1px solid red;
                                width: 100px;
                                cursor: pointer;
                                .sp2 {
                                    color: #999;
                                }
                            }
                        }
                        .w4_2_3 {
                            border-bottom: 1px solid #ebebeb;
                            // padding: 3px;
                            .ti1 {
                                // border: 1px solid red;
                                font-size: 15px;
                                display: flex;
                                padding: 6px;
                            }
                            .ti1:hover {
                                background-color: #00c3ff;
                                cursor: pointer;
                                color: white;
                            }
                        }
                        .w4_2_4:hover {
                            background-color: #00c3ff;
                            cursor: pointer;
                            color: white;
                        }
                        .w4_2_4 {
                            // border: 1px solid red;
                            display: flex;
                            padding: 5px;
                            font-size: 15px;
                            color: #999;
                            padding-left: 10px;
                            padding-bottom: 15px;
                        }
                    }
                }
                .w4_1:hover {
                    .w4_2 {
                        display: block;
                    }
                }
                .w44 {
                    border: 1px solid red;
                    font-size: 25px;
                    margin-left: 20px;
                    color: white;
                    cursor: pointer;
                }
            }
        }
    }
    .index2 {
        display: flex;
        justify-content: center;
        margin-top: 56px;
        background-color: #f7f5f5;
        // height: 100%;
        // position: relative;
        // background: url('https://bbs.mihoyo.com/_nuxt/img/background.cd0a312.png') no-repeat 0 62px;
        // border: 1px solid red;
    }
</style>